home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CShotArtilleryShell.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  3.8 KB  |  150 lines

  1.  
  2. {
  3.    if(true)
  4.    {
  5.       CShotArtilleryShell = ┬º┬ºnewclass(CShotArtilleryShell,CShot);
  6.    }
  7. }
  8.  
  9. package Local.Game.Thing
  10. {
  11.    import Local.Game.World.*;
  12.    import Local.Game.World.Map.*;
  13.    import Local.Game.World.Map.Cell.*;
  14.    import Local.Math.*;
  15.    import STC9.System.*;
  16.    import flash.display.*;
  17.    import flash.events.*;
  18.    import flash.geom.*;
  19.    
  20.    public class CShotArtilleryShell extends CShot
  21.    {
  22.        
  23.       
  24.       private var mPath:CPath;
  25.       
  26.       public function CShotArtilleryShell(param1:CPosition, param2:Number = -200)
  27.       {
  28.          var _loc3_:CPosition = null;
  29.          _loc3_ = new CPosition();
  30.          ┬º┬ºpush(_loc3_);
  31.          ┬º┬ºpush(param1.x - 2000);
  32.          if(true)
  33.          {
  34.             ┬º┬ºpush(┬º┬ºpop() - Math.random() * 500);
  35.          }
  36.          ┬º┬ºpop().x = ┬º┬ºpop();
  37.          ┬º┬ºpush(_loc3_);
  38.          ┬º┬ºpush(param2);
  39.          if(true)
  40.          {
  41.             ┬º┬ºpush(┬º┬ºpop() + (Math.random() * 150 + 20));
  42.          }
  43.          ┬º┬ºpop().y = ┬º┬ºpop();
  44.          super(_loc3_);
  45.          mType = "artilleryshell";
  46.          Process = Process_Normal;
  47.          mAngle = new CAngle();
  48.          ┬º┬ºpush(┬º┬ºfindproperty(mMaxSpeed));
  49.          ┬º┬ºpush(150 + Math.random() * 30);
  50.          if(true)
  51.          {
  52.             ┬º┬ºpush(┬º┬ºpop() * mSpriteScalar);
  53.          }
  54.          ┬º┬ºpop().mMaxSpeed = ┬º┬ºpop();
  55.          mSpeed = mMaxSpeed;
  56.          mAcceleration = 1;
  57.          mOrientation = 1;
  58.          mMaxLife = mLife = 1;
  59.          AddAnimation("stand",Artillery_Shell,"AddSprite_Black");
  60.          mShowOnMap = true;
  61.          mTarget = param1;
  62.          SetState("FOLLOWPATH");
  63.       }
  64.       
  65.       public function State_FOLLOWPATH_Enter() : void
  66.       {
  67.          if(true)
  68.          {
  69.             mPath = new CPath();
  70.             if(true)
  71.             {
  72.                ┬º┬ºpush(mPath);
  73.                if(true)
  74.                {
  75.                   ┬º┬ºpop().SetPath([mPosition,new Point((mPosition.x + mTarget.x) * 0.6,mPosition.y),mTarget]);
  76.                   addr49:
  77.                   ┬º┬ºpush(mPath);
  78.                }
  79.                ┬º┬ºpop().OrientateThing(this);
  80.                ┬º┬ºgoto(addr52);
  81.             }
  82.             ┬º┬ºgoto(addr49);
  83.          }
  84.          addr52:
  85.       }
  86.       
  87.       public function State_FOLLOWPATH_Exit() : void
  88.       {
  89.       }
  90.       
  91.       public function State_NOPATH() : void
  92.       {
  93.          mDelta = CPosition.NORMALIZE(mAngle.mDelta,mSpeed);
  94.          mPosition.Add(mDelta);
  95.       }
  96.       
  97.       override public function Draw() : void
  98.       {
  99.          var _loc1_:Matrix = null;
  100.          super.Draw();
  101.          DrawTrail(3,90);
  102.          _loc1_ = GetOrientationMatrix();
  103.          DrawSprite(_loc1_);
  104.       }
  105.       
  106.       public function Process_Normal() : void
  107.       {
  108.          var _loc1_:Point = null;
  109.          Accelerate_Speed();
  110.          if(Process_State != null)
  111.          {
  112.             Process_State();
  113.          }
  114.          if(MapMoveTrail())
  115.          {
  116.             Process_ReachedObjective();
  117.          }
  118.          _loc1_ = OrientatePoint(mSprite.mObjects["payload"].mPosition.clone(),mPosition);
  119.          if(_loc1_.y >= mLandscape.GetAltitude(_loc1_.x))
  120.          {
  121.             AddThing(new CEffectExplosionLarge(new CPosition(_loc1_.x,mLandscape.GetAltitude(_loc1_.x))));
  122.             mDead = true;
  123.          }
  124.          if(mDead)
  125.          {
  126.             DispatchDispose();
  127.          }
  128.       }
  129.       
  130.       public function State_NOPATH_Exit() : void
  131.       {
  132.       }
  133.       
  134.       public function State_NOPATH_Enter() : void
  135.       {
  136.       }
  137.       
  138.       public function State_FOLLOWPATH() : void
  139.       {
  140.          if(!mPath.MoveAlong(mSpeed))
  141.          {
  142.             SetState("NOPATH");
  143.             Process_State();
  144.             return;
  145.          }
  146.          mPath.OrientateThing(this);
  147.       }
  148.    }
  149. }
  150.